#!/bin/sh

# 网利宝用户中心  开发环境
url="http://nie.wanglibao.com/service.php?c=account";

if [ "$#" -ne 2 ];
then
	echo "参数错误 Ex:lo.sh 13126666448 111111";
	exit 1;
fi

username=$1;
userpass=$2;
#echo "params num:$#"
#echo "用户：$1";

post_data="{
    \"jsonrpc\": \"2.0\",
    \"method\": \"signin\",
    \"params\": [
        {
            \"username\": $username,
            \"password\": $userpass
        }
    ],
    \"id\": 1
}";

##cookie_file="./"${username}".cookie";
cookie_file="./cookie.txt";


curl -c "$cookie_file" -X POST \
  "$url" \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: 4cbc8f4f-1eec-cb89-c462-1f20ddc3b857' \
  -d "$post_data"

##echo $post_data;
